package com.ndp.fb.rdb.model;

import com.ndp.fb.rdb.annotation.Column;
import com.ndp.fb.rdb.annotation.Id;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.io.Serializable;

/**
 * Created by elvisxiong on 7/8/15.
 *
 */
@Setter
@Getter
@NoArgsConstructor
public class Menu implements Serializable,Comparable<Menu> {

    //编码
    @Id
    private Long id;
    //菜单名称
    //Column:name
    private String name;
    //状态 0 不可用,1 可用
    //Column:status
    private Integer status;
    //Column:widget
    private String widget;
    //Column:icon
    private String icon;
    //父节点id
    @Column(value = "f_id")
    private Long fid;
    //排序值
    private Integer sort;
    //是否有子节点
    @Column(value = "isLeafNode")
    private Boolean isLeafNode;

    public void setIsLeafNode(Boolean leafNode) {
        isLeafNode = leafNode;
    }

    @Override
    public int compareTo(Menu menu) {
        return this.getSort().compareTo(menu.getSort());
    }
}
